/**
 * Created by WangMing on 15/12/9.
 */
define([  "../../service",
  "../../widgets/collectionWidget/collectionWidget",
  "../../widgets/breadcrumb_widget/breadcrumb_widget"
  ], function (api) {
  // 定义所有相关的vmodel
  var vm = avalon.define({
      $id: "albums",
      
      $breadcrumb: {
        stateName:"albums",
        guid: "",
        title: null
      },
      // finishLoad:false,
      results:{
        params:{
            method: api.getAlbums,
            query:{
                OrderType: 0,
                PageSize:12
            }
        },

        // has_pager: true,
        totalItems:30
      },
      
      displayPage:function(state){
        return state.vmName == "albums";
      },
      $albums:{},
      $skipArray:["$playerWidget", "results","breadcrumbWidget"]
    });

  return avalon.controller(function ($ctrl) {

    // 视图渲染后，意思是avalon.scan完成
    $ctrl.$onRendered = function () {


    };
    // 进入视图
    $ctrl.$onEnter = function (param, rs, rj) {
      // vm.finishLoad = false
      // setTimeout(function(){
      //   vm.finishLoad = true;
      // },100)
    };
    // 对应的视图销毁前
    $ctrl.$onBeforeUnload = function () {
      
    };
    $ctrl.$vmodels = [vm];
  })
}); 